#include <iostream>
#include <string>

#include "packet_base.h"
#include "log.h"
#include "sunnet.h"

using namespace std;


void Test(){
    PacketBase base;
    base.Begin(100);
    const char* s = "hello";
    base.WriteInt16(200);
    base.WriteString(s);
    base.End();

    uint16_t cmd = base.GetCmd();
    uint16_t body_size = base.GetBodySize();
    cout << cmd << endl;
    cout << body_size << endl;

    base.ResetPos();

    int16_t val = base.ReadInt16();
    cout << val << endl;
    string ss = base.ReadString();
    cout << ss << endl;
}

void TestUserdata(){
    Log::GetInstance().Init();
    Sunnet::GetInstance().Start();

    auto t = make_shared<string>("test");
    uint32_t test = Sunnet::GetInstance().NewService(t);

    Sunnet::GetInstance().Wait();
}

void TestSocketPacket(){
    Log::GetInstance().Init();
    Sunnet::GetInstance().Start();

    auto t = make_shared<string>("main");
    uint32_t test = Sunnet::GetInstance().NewService(t);

    Sunnet::GetInstance().Wait();
}

int main(int argc, char const *argv[])
{
    TestSocketPacket();
    return 0;
}
